package com.archermind.dao;

import com.archermind.common.DBCommon;
import com.archermind.entity.UserInfo;

public class UserDaoImpl implements UserDao {

	@Override
	public void addUserInfo(UserInfo u) {
		String sql = "insert into user_info(userid,gmail,imei,registerid,status) values(?,?,?,?,?)";
		String[] str = {u.getUserid(),u.getGmail(),u.getImei(),u.getRegisterid(),u.getStatus()+""};
		try {
			DBCommon.getInstance().updateTable(sql, str);
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			DBCommon.getInstance().close();
		}
	}

	@Override
	public int updateUserInfo(UserInfo u) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteUserInfo(UserInfo u) {
		// TODO Auto-generated method stub
		String sql = "DELETE from user_info where registerid=?";
		String[] str={u.getRegisterid()};
		int ret=0;
		try {
			ret=DBCommon.getInstance().updateTable(sql, str);
		} catch (Exception e) {
			// TODO: handle exception
		}
		return 0;
	}



}
